Shared Chat
Model: Default

Refactor project, multiple frameworks.

July 6, 2023
You are a commit message generator for the C# project. I will give you a code change from the C# repository and you tell me its commit message. The output format is one sentence. The code change is ```diff diff --git a/src/Abp.AspNetCore/Abp.AspNetCore.csproj b/src/Abp.AspNetCore/Abp.AspNetCore.csproj index b9cdf3cf9b..55c33198fc 100644 --- a/src/Abp.AspNetCore/Abp.AspNetCore.csproj +++ b/src/Abp.AspNetCore/Abp.AspNetCore.csproj @@ -3,7 +3,7 @@ <Import Project="..\..\common.props" /> <PropertyGroup> - <TargetFramework>net461</TargetFramework> + <TargetFrameworks>net46;netstandard1.6</TargetFrameworks> <GenerateDocumentationFile>true</GenerateDocumentationFile> <AssemblyName>Abp.AspNetCore</AssemblyName> <PackageId>Abp.AspNetCore</PackageId> @@ -19,8 +19,12 @@ </PropertyGroup> <ItemGroup> - <None Update="bin\Release\net461\Abp.AspNetCore.pdb"> - <PackagePath>lib/net461/</PackagePath> + <None Update="bin\Release\net46\Abp.AspNetCore.pdb"> + <PackagePath>lib/net46/</PackagePath> + <Pack>true</Pack> + </None> + <None Update="bin\Release\netstandard1.6\Abp.AspNetCore.pdb"> + <PackagePath>lib/netstandard1.6/</PackagePath> <Pack>true</Pack> </None> </ItemGroup> @@ -30,18 +34,15 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Castle.LoggingFacility.MsLogging" Version="1.1.0" /> - <PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="1.3.3" /> + <PackageReference Include="Castle.LoggingFacility.MsLogging" Version="2.0.0" /> + <PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="2.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /> <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" /> </ItemGroup> - <ItemGroup Condition=" '$(TargetFramework)' == 'net461' "> + <ItemGroup Condition=" '$(TargetFramework)' == 'net46' "> <Reference Include="System" /> <Reference Include="Microsoft.CSharp" /> - </ItemGroup> - - <ItemGroup> <Reference Include="System.Transactions" /> </ItemGroup> diff --git a/src/Abp.AspNetCore/AspNetCore/AbpAspNetCoreModule.cs b/src/Abp.AspNetCore/AspNetCore/AbpAspNetCoreModule.cs index 2ce4eaa8cb..1b2bf458b2 100644 --- a/src/Abp.AspNetCore/AspNetCore/AbpAspNetCoreModule.cs +++ b/src/Abp.AspNetCore/AspNetCore/AbpAspNetCoreModule.cs @@ -9,6 +9,7 @@ using Abp.Configuration.Startup; using Abp.Dependency; using Abp.Modules; +using Abp.Reflection.Extensions; using Abp.Runtime.Session; using Abp.Web; using Abp.Web.MultiTenancy; @@ -40,7 +41,7 @@ public override void PreInitialize() public override void Initialize() { - IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); + IocManager.RegisterAssemblyByConvention(typeof(AbpAspNetCoreModule).GetAssembly()); } public override void PostInitialize() diff --git a/src/Abp.AspNetCore/AspNetCore/Configuration/ControllerAssemblySettingList.cs b/src/Abp.AspNetCore/AspNetCore/Configuration/ControllerAssemblySettingList.cs index e0f48b3e13..87d9d86df5 100644 --- a/src/Abp.AspNetCore/AspNetCore/Configuration/ControllerAssemblySettingList.cs +++ b/src/Abp.AspNetCore/AspNetCore/Configuration/ControllerAssemblySettingList.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Abp.Reflection.Extensions; using JetBrains.Annotations; namespace Abp.AspNetCore.Configuration @@ -10,7 +11,7 @@ public class ControllerAssemblySettingList : List<AbpControllerAssemblySetting> [CanBeNull] public AbpControllerAssemblySetting GetSettingOrNull(Type controllerType) { - return this.FirstOrDefault(controllerSetting => controllerSetting.Assembly == controllerType.Assembly); + return this.FirstOrDefault(controllerSetting => controllerSetting.Assembly == controllerType.GetAssembly()); } } } \ No newline at end of file diff --git a/src/Abp.AspNetCore/AspNetCore/Mvc/Controllers/AbpScriptsController.cs b/src/Abp.AspNetCore/AspNetCore/Mvc/Controllers/AbpScriptsController.cs index 0c13f79027..052b6cc020 100644 --- a/src/Abp.AspNetCore/AspNetCore/Mvc/Controllers/AbpScriptsController.cs +++ b/src/Abp.AspNetCore/AspNetCore/Mvc/Controllers/AbpScriptsController.cs @@ -62,8 +62,8 @@ public async Task<ActionResult> GetScripts(string culture = "") { if (!culture.IsNullOrEmpty()) { - Thread.CurrentThread.CurrentCulture = new CultureInfo(culture); - Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture); + CultureInfo.CurrentCulture = new CultureInfo(culture); + CultureInfo.CurrentUICulture = new CultureInfo(culture); } var sb = new StringBuilder(); diff --git a/src/Abp.AspNetCore/AspNetCore/Mvc/Conventions/AbpAppServiceConvention.cs b/src/Abp.AspNetCore/AspNetCore/Mvc/Conventions/AbpAppServiceConvention.cs index 02d5366edf..d5a72a0150 100644 --- a/src/Abp.AspNetCore/AspNetCore/Mvc/Conventions/AbpAppServiceConvention.cs +++ b/src/Abp.AspNetCore/AspNetCore/Mvc/Conventions/AbpAppServiceConvention.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.Extensions.DependencyInjection; using System.Linq; +using System.Reflection; using Abp.Collections.Extensions; using Abp.Web.Api.ProxyScripting.Generators; using JetBrains.Annotations; @@ -39,7 +40,7 @@ public void Apply(ApplicationModel application) var type = controller.ControllerType.AsType(); var configuration = GetControllerSettingOrNull(type); - if (typeof(IApplicationService).IsAssignableFrom(type)) + if (typeof(IApplicationService).GetTypeInfo().IsAssignableFrom(type)) { controller.ControllerName = controller.ControllerName.RemovePostFix(ApplicationService.CommonPostfixes); configuration?.ControllerModelConfigurer(controller); @@ -49,7 +50,7 @@ public void Apply(ApplicationModel application) } else { - var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(type); + var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(type.GetTypeInfo()); if (remoteServiceAtt != null && remoteServiceAtt.IsEnabledFor(type)) { ConfigureRemoteService(controller, configuration); @@ -144,7 +145,7 @@ private void ConfigureApiExplorer(ControllerModel controller) if (controller.ApiExplorer.IsVisible == null) { var controllerType = controller.ControllerType.AsType(); - var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(controllerType); + var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(controllerType.GetTypeInfo()); if (remoteServiceAtt != null) { controller.ApiExplorer.IsVisible = diff --git a/src/Abp.AspNetCore/AspNetCore/Mvc/Providers/AbpAppServiceControllerFeatureProvider.cs b/src/Abp.AspNetCore/AspNetCore/Mvc/Providers/AbpAppServiceControllerFeatureProvider.cs index 9ee972303d..6683e04085 100644 --- a/src/Abp.AspNetCore/AspNetCore/Mvc/Providers/AbpAppServiceControllerFeatureProvider.cs +++ b/src/Abp.AspNetCore/AspNetCore/Mvc/Providers/AbpAppServiceControllerFeatureProvider.cs @@ -25,12 +25,12 @@ protected override bool IsController(TypeInfo typeInfo) var type = typeInfo.AsType(); if (!typeof(IApplicationService).IsAssignableFrom(type) || - !type.IsPublic || type.IsAbstract || type.IsGenericType) + !typeInfo.IsPublic || typeInfo.IsAbstract || typeInfo.IsGenericType) { return false; } - var remoteServiceAttr = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(type); + var remoteServiceAttr = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(typeInfo); if (remoteServiceAttr != null && !remoteServiceAttr.IsEnabledFor(type)) { diff --git a/src/Abp.AspNetCore/AspNetCore/Mvc/Proxying/AspNetCoreApiDescriptionModelProvider.cs b/src/Abp.AspNetCore/AspNetCore/Mvc/Proxying/AspNetCoreApiDescriptionModelProvider.cs index 71b9a84d0a..983da90086 100644 --- a/src/Abp.AspNetCore/AspNetCore/Mvc/Proxying/AspNetCoreApiDescriptionModelProvider.cs +++ b/src/Abp.AspNetCore/AspNetCore/Mvc/Proxying/AspNetCoreApiDescriptionModelProvider.cs @@ -6,6 +6,7 @@ using Abp.AspNetCore.Mvc.Proxying.Utils; using Abp.Dependency; using Abp.Extensions; +using Abp.Reflection.Extensions; using Abp.Web.Api.Modeling; using Castle.Core.Logging; using Microsoft.AspNetCore.Mvc.ApiExplorer; @@ -125,7 +126,7 @@ private string GetModuleName(ApiDescription apiDescription) foreach (var controllerSetting in _configuration.ControllerAssemblySettings) { - if (controllerType.Assembly == controllerSetting.Assembly) + if (controllerType.GetAssembly() == controllerSetting.Assembly) { return controllerSetting.ModuleName; } diff --git a/src/Abp.AspNetCore/AspNetCore/Mvc/Results/ActionResultHelper.cs b/src/Abp.AspNetCore/AspNetCore/Mvc/Results/ActionResultHelper.cs index 36d62ba019..e6333ffc58 100644 --- a/src/Abp.AspNetCore/AspNetCore/Mvc/Results/ActionResultHelper.cs +++ b/src/Abp.AspNetCore/AspNetCore/Mvc/Results/ActionResultHelper.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -13,14 +14,14 @@ public static bool IsObjectResult(Type returnType) { returnType = typeof(void); } - else if (returnType.IsGenericType && returnType.GetGenericTypeDefinition() == typeof(Task<>)) + else if (returnType.GetTypeInfo().IsGenericType && returnType.GetGenericTypeDefinition() == typeof(Task<>)) { returnType = returnType.GenericTypeArguments[0]; } - if (typeof(IActionResult).IsAssignableFrom(returnType)) + if (typeof(IActionResult).GetTypeInfo().IsAssignableFrom(returnType)) { - if (typeof(JsonResult).IsAssignableFrom(returnType) || typeof(ObjectResult).IsAssignableFrom(returnType)) + if (typeof(JsonResult).GetTypeInfo().IsAssignableFrom(returnType) || typeof(ObjectResult).GetTypeInfo().IsAssignableFrom(returnType)) { return true; } ```
ChatGPTChatGPT

Refactor project to target multiple frameworks and update package references.